<?php 
require_once ("../mobile/shop.php");
require_once("../includes/public.inc.php");
$pro = getProductDetail($_GET['id']);

session_start();
$userinfo = isset($_SESSION['userinfo'])?$_SESSION['userinfo']:'';
$credit = '';
if (!empty($userinfo)) {
	$credit = 20;
}
// var_dump($userinfo);exit;
?>
<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,user-scalable=no,maximum-scale=1,initial-scale=1">
<title>产品详情</title>
<link type="text/css" href="css/css.css" rel="stylesheet" />
<link type="text/css" href="css/pz-mobile.css" rel="stylesheet" />
<script type="text/javascript" src="../hongbao/js/jQuery.js"></script>
<style>
.pz-panel img{max-width:100%}
hr{border:0;background-color:#ecebf1;height:1px;}
.select{height: 40px}
.select li a{padding: 2px 5px;color: #000;border: 1px solid #DCDCDC;background: #FFF}
.select li{float: left;position: relative;margin: 10px 5px 10px 0;vertical-align: middle;line-height: 20px;background: #FFF}
.select li a:hover{padding: 2px 5px;color: #F40;border: 1px solid #F40;background: #FFF}
</style>
<script type="text/javascript">
$("#submit").click(function (){
	if ($(".size").val() == '')
	{
		alert("请选择商品属性");return false;
	}
	if ($(".color").val() == '')
	{
		alert("请选择颜色属性");return false;
	}
});
if ($(this).is(":checked"))
{
	$(".list_table input[type='checkbox']").attr("checked", true);
}
else
{
	$(".list_table input[type='checkbox']").attr("checked", false);
}
</script>
<ul class="top-tool" style="top:0px; left:0px">
	<li class="title">商品详情</li>
	<li class="back"><a href="javascript:history.go(-1)"></a></li>
</ul>
<div style="height:50px"></div>
<div style="-moz-box-shadow: 0px 0px 56px #999; -webkit-box-shadow: 0px 0px 6px #999; box-shadow: 0px 0px 6px #999; background:#fff;">
<ul class="bxslider" style="margin-top:0px">
	<li><img  src='<?=$pro['img'];?>' width='100%'></li>
</ul>
	<div style="padding:10px 20px 2px">
		<form action="comfirmorder.php" method="post">
			<div style="float: right"><input type="submit" value="红包抵现购买" id="submit" style="border:none;background:red;color:#fff;height:40px;width:100%;border-radius: 10px;margin-left: 10px;"/></div>
			<div>
				<input type="hidden" name="id" value="<?=$_GET['id']?>" />
				<h5 style="font-size:1.2rem"><?=$pro['name'];?></h5>
				<h4 style="font-size:1.2rem;color:#ff6600;font-weight:bold">
				<?if ($credit) 
					echo "<span style='color:red;font-size:1.4rem'>¥&nbsp;".($pro['price']-$credit)."</span>&nbsp;<span style='font-size:0.9rem'>+".$credit."</span><span style='color:gray;font-size:0.8rem;'>&nbsp;&nbsp;原价&nbsp;<a style='text-decoration:line-through'></a>".$pro['price']."</span>
					<p style='color:gray;font-size:0.7rem'>（红包金额:¥ ".$credit." + ¥".($pro['price']-$credit)."）红包可抵现".$credit."元</p>";
				  else 
				  	echo "¥&nbsp;".$pro['price'];
				?>
				</h4>
				<hr/>
				<h5>颜色分类：</h5>
				<ul class="select">
					<?php 
					$color = explode(',', $pro['color']);
					$i = 0;
					foreach ($color as $c)
					{
						$c = trim($c);
						if ($i == 0)
						{
							echo '<li><a href="javascript:void(0);" ><input type="radio" class="color" name="color" value="'.$c.'" checked="checked"/>'.$c.'</a></li>';
							$i++;
							continue;
						}
						echo '<li><a href="javascript:void(0);" ><input type="radio" class="color" name="color" value="'.$c.'" />'.$c.'</a></li>';
					}
	 				?>
				</ul>
				<h5 style="font-size:0.8rem;clear: both">商品规格：</h5>
				<ul class="select">
					<?php 
					$size = explode(',', $pro['size']);
					$i = 0;
					foreach ($size as $s)
					{
						$s = trim($s);
						if ($i == 0)
						{
							echo '<li><a href="javascript:void(0);" ><input type="radio" class="size" name="size" value="'.$s.'" checked="checked"/>'.$s.'</a></li>';
							$i++;
							continue;
						}
						echo '<li><a href="javascript:void(0);" ><input type="radio" class="size" name="size" value="'.$s.'"/>'.$s.'</a></li>';
					}
					?>
				</ul>
			</div>
		</form>
	</div>
</div>
<div id="xq" class="pz-panel" style="clear:both">
	<pre><p style="border-bottom: 1px solid #d6d6d8;padding-bottom: 9px;"><span style="border: 2px solid #ff6600;border-width: 2px 2px 0px 2px;color:#ff6600;padding:10px;font-weight:bold">产品详情</span></p></pre>
	<?=htmlspecialchars_decode($pro['desc']);?>
</div>
<div style="height:70px"></div>
<div style="position:fixed; bottom:0px; width:100%; background:#f0f0f0;border-top:#ccc solid 1px; left:0px;">
	<div style="padding:0px;position:relative;margin:8px 6px;">
	    <ul class="nav">
	    <li onClick="#"><img src="./images/58.png"><p>红包</p></li>
	    <li onClick="#"><img src="./images/62.png"><p>提现</p></li>
	    <li onClick="window.location='../hongbao/productlist.php'"><img src="./images/56.png"><p>产品</p></li>
	    <li style="border-right:none" onClick="location.href='#'">
	       <img src="./images/65.png"><p>我的</p>
	    </li>
	    </ul>
	    <div style="clear:left">
	    </div>
	</div>
</div>
</body>
</html>